<template>
  <div>
    <el-table :data="resumeOnelist" border>
      <el-table-column prop="job" label="职位"></el-table-column>
      <el-table-column prop="uname" label="求职者姓名"></el-table-column>
      <el-table-column prop="sallow" label="期望薪资"></el-table-column>
      <el-table-column prop="content" label="期望行业"></el-table-column>
      <el-table-column label="简历">
        <template slot-scope="scope">
          <el-link :href="resumeh + scope.row.resume" target="_blank"
            ><i class="el-icon-view el-icon--right" @click="pass(scope.row.id,1,'查看 +1')">查看 或 下载</i>
          </el-link>
          <!-- <a :href="resumeh+scope.row.resume" download="简历" target="_blank"><i class="el-icon-view el-icon--right">查看 或 下载</i> </a> -->
        </template>
      </el-table-column>
      <el-table-column fixed="right" label="操作" width="200">
        <template slot-scope="scope">
          <el-button @click="pass(scope.row.id,3,'面试 +1')" type="text" size="small"
            >约面试</el-button
          >
          <el-button @click="pass(scope.row.id,5,'淘汰 +1')" type="text" size="small"
            >不合适</el-button
          >
          <el-button @click="pass(scope.row.id,2,'收藏 +1')" type="text" size="small"
            >收藏</el-button
          >
        </template>
      </el-table-column>
    </el-table>
    <!--    编辑-->
    <!-- <el-dialog title="编辑" :close-on-click-modal="false" :visible.sync="editDialog">
      <el-form status-icon :model="editForm" ref="editFormRef"
               label-width="70px">
        <el-form-item label="用户名" prop="username">
          <el-input type="text" v-model="editForm.username"></el-input>
        </el-form-item>
        <el-form-item label="求职行业" prop="industry">
          <el-input  type="text" v-model="editForm.industry"></el-input>
        </el-form-item>
        <el-form-item label="工作经验" prop="workExperience">
          <el-input type="text" v-model="editForm.workExperience"></el-input>
        </el-form-item>
        <el-form-item label="工作地点" prop="address">
          <el-input type="text" v-model="editForm.address"></el-input>
        </el-form-item>
        <el-form-item label="期望薪资" prop="salary">
          <el-input type="text" v-model="editForm.salary"></el-input>
        </el-form-item>
        <el-form-item label="意向职位" prop="intentionJob">
          <el-input type="text" v-model="editForm.intentionJob"></el-input>
        </el-form-item>
        <el-form-item label="求职状态" prop="jobStatus">
          <el-input type="text" v-model="editForm.jobStatus"></el-input>
        </el-form-item>
        <el-form-item label="个人介绍" prop="personalIntroduction">
          <el-input type="text" v-model="editForm.personalIntroduction"></el-input>
        </el-form-item>
        <el-form-item label="创建时间" prop="createTime">
          <el-input type="text" v-model="editForm.createTime" disabled></el-input>
        </el-form-item>
        <el-form-item label="有效时间" prop="validTime">
          <el-input type="text" v-model="editForm.validTime"></el-input>
        </el-form-item>
      </el-form>
      <div class="register-button" slot="footer">
        <el-button @click="editDialog=false">取 消</el-button>
        <el-button type="primary" @click="editInfo('editFormRef')">提交修改</el-button>
      </div>
    </el-dialog> -->
  </div>
</template>

<script>
export default {
  data() {
    return {
      resumeh:
        "https://gra-1257734071.cos.ap-guangzhou.myqcloud.com/resume-user/",
      resumeOnelist: [],
    };
  },
  methods: {
    selectResume(state) {
      console.log("状态：", state);
      var id = this.$store.state.userId;
      console.log("获取userId:", id);
      var url = this.$store.state.ip + "/userRe/userReC";
      // 参数
      let param = new URLSearchParams();
      param.append("cid", id);
      // param.append("state", state);
      this.$axios({
        method: "post",
        url: url,
        data: param,
      }).then((res) => {
        console.log(res.data);
        this.resumeOnelist = res.data;
      });
    },
    pass(rid,state,msg) {
      console.log("被修改的职位：", rid);
      var id = this.$store.state.userId;
      console.log("获取userId:", id);
      var url = this.$store.state.ip + "/userRe/updateState";
      // 参数
      let param = new URLSearchParams();
      param.append("id", rid);
      param.append("state", state);
      this.$axios({
        method: "post",
        url: url,
        data: param,
      }).then((res) => {
        console.log(res.data);
        if (res.data == 1) {
          this.$router.go(0);
          this.$message({
            message: "操作成功！"+msg,
            type: "success",
          });
        }
      });
    },
    down(rid) {
      console.log("被修改的职位：", rid);
      var id = this.$store.state.userId;
      console.log("获取userId:", id);
      var url = this.$store.state.ip + "/userRe/updateState";
      // 参数
      let param = new URLSearchParams();
      param.append("id", rid);
      param.append("state", 5);
      this.$axios({
        method: "post",
        url: url,
        data: param,
      }).then((res) => {
        console.log(res.data);
        if (res.data == 1) {
          this.$router.go(0);
          this.$message({
            message: "已淘汰一面求职者",
            type: "success",
          });
        }
      });
    },
  },
  beforeMount() {
    this.selectResume(0);
  },
};
</script>